package com.centaline.androidsalesblog.base;

import com.centaline.androidsalesblog.R;
import com.centaline.androidsalesblog.adapter.IndexFragmentAdapter;
import com.centaline.androidsalesblog.widgets.IndexViewPager;

import java.util.ArrayList;

/**
 * 门店列表\地图双模式基类
 * Created by Lihq on 16/2/19.
 */
public abstract class BaseStoreListMapActivity extends BaseActivity {

    protected IndexViewPager viewPager;

    protected IndexFragmentAdapter indexFragmentAdapter;
    protected ArrayList<BaseFragment> fragmentArrayList = new ArrayList<>();

    private boolean mode;//true:列表;false:地图

    @Override
    protected int setLayoutId() {
        return R.layout.activity_store_list_map;
    }

    @Override
    protected void findViews() {
        viewPager = (IndexViewPager) findViewById(R.id.viewPager);
    }

    @Override
    protected void initViews() {
        fragmentArrayList.add(getFragment2());
        fragmentArrayList.add(getFragment1());
        indexFragmentAdapter = new IndexFragmentAdapter(getSupportFragmentManager(), fragmentArrayList);
        viewPager.setAdapter(indexFragmentAdapter);
    }

    /**
     * 第一个BaseFragment
     */
    protected abstract BaseFragment getFragment1();

    /**
     * 第二个BaseFragment
     */
    protected abstract BaseFragment getFragment2();


}
